package reflect;

import reflect.annotations.AutoRunMethod;

import java.lang.reflect.Method;

/**
 * 方法上查看注解
 */
public class ReflectDemo9 {
    public static void main(String[] args) throws Exception{
        Class cls = Class.forName("reflect.Person");
        Method[] methods = cls.getMethods();
        for (Method method:methods){
            if (method.isAnnotationPresent(AutoRunMethod.class)){
                System.out.println(method.getName()+":被注解AutoRunMethod");
            }else {
                System.out.println(method.getName()+":没有被注解AutoRunMethod");

            }
        }
    }
}
